/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;

init(config: OpenApi.Config){
  super(config);
  @endpointRule = '';
  

  checkConfig(config);
  @endpoint = getEndpoint('umeng-finplus', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }

  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}
model CreditServiceRequest {
  appId?: long(name='AppId', description='param0'),
  clientInfo?: string(name='ClientInfo', description='param9'),
  date?: string(name='Date'),
  extendInfo?: string(name='ExtendInfo', description='param8'),
  idType?: string(name='IdType', description='param3'),
  idValue?: string(name='IdValue', description='param2'),
  loanDate?: string(name='LoanDate', description='param7'),
  reqId?: string(name='ReqId', description='param1'),
  sign?: string(name='Sign', description='param4'),
  token?: string(name='Token', description='param5'),
}

model CreditServiceResponseBody = {
  code?: int32(name='Code', description='code'),
  message?: string(name='Message', description='message'),
  response?: {
    bizId?: string(name='BizId', description='biz_id'),
    reqId?: string(name='ReqId', description='req_id'),
    tags?: string(name='Tags', description='tags'),
  }(name='Response', description='response'),
  success?: boolean(name='Success', description='success'),
}

model CreditServiceResponse = {
  headers: map[string]string(name='headers'),
  body: CreditServiceResponseBody(name='body'),
}

async function creditServiceWithOptions(request: CreditServiceRequest, runtime: Util.RuntimeOptions): CreditServiceResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreditService',
    version = '2021-11-24',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function creditService(request: CreditServiceRequest): CreditServiceResponse {
  var runtime = new Util.RuntimeOptions{};
  return creditServiceWithOptions(request, runtime);
}

model SendBatchMessageRequest {
  phoneNumberJson?: string(name='PhoneNumberJson'),
  signNameJson?: string(name='SignNameJson'),
  templateCode?: string(name='TemplateCode'),
  templateParamJson?: string(name='TemplateParamJson'),
}

model SendBatchMessageResponseBody = {
  code?: string(name='Code'),
  data?: map[string]any(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId'),
}

model SendBatchMessageResponse = {
  headers: map[string]string(name='headers'),
  body: SendBatchMessageResponseBody(name='body'),
}

async function sendBatchMessageWithOptions(request: SendBatchMessageRequest, runtime: Util.RuntimeOptions): SendBatchMessageResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    body = Util.toMap(request),
  };
  var params = new OpenApi.Params{
    action = 'SendBatchMessage',
    version = '2021-11-24',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function sendBatchMessage(request: SendBatchMessageRequest): SendBatchMessageResponse {
  var runtime = new Util.RuntimeOptions{};
  return sendBatchMessageWithOptions(request, runtime);
}

